<?php
/**
 * Created by PhpStorm OF Administrator.
 * User: YUYI
 * Date: 2018/7/12 0012
 * Time: 上午 11:10
 * Administrator
 */

namespace app\common\model;


use think\Model;

class UserEquipments extends BaseModel
{
    protected $autoWriteTimestamp = 'dateTime';
    protected $updateTime = false;

    public function getUserBannerImgUrlHostAttr($value,$data)
    {
        if ($data['user_banner_img_url'] && strpos($data['user_banner_img_url'],'http')===false)
            return 'http://'.$_SERVER['HTTP_HOST'].$data['user_banner_img_url'];
        else
            return $value;
    }

    public function getUserInfo()
    {
        $this->belongsTo('Users','id','user_id');
    }
}